//
//  LSRLoginController.m
//  BaiSiProject
//
//  Created by lshenrong on 16/7/7.
//  Copyright © 2016年 lshenrong. All rights reserved.
//

#import "LSRLoginController.h"
#import "LSRLoginView.h"
#import "LSRFastLoginView.h"


@interface LSRLoginController ()
@property (weak, nonatomic) IBOutlet UIView *middleView;
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *leadingCon;
@property (weak, nonatomic) IBOutlet UIView *bottomView;




@end

@implementation LSRLoginController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    LSRLoginView *loginView=[LSRLoginView logingView];
    
    [self.middleView addSubview:loginView];
    
    LSRLoginView *registerView=[LSRLoginView registerView];
    
    [self.middleView addSubview:registerView];
    
     //添加底部LSRFastLoginView
    LSRFastLoginView *fastLoginView=[LSRFastLoginView fastLoginView];
    
    [self.bottomView addSubview:fastLoginView];
    
    
    
    
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}
- (IBAction)dropOut:(UIButton *)button {
    
    [self dismissViewControllerAnimated:YES completion:nil];
}
- (IBAction)registerLogin:(UIButton *)button{
    
    button.selected=!button.selected;
    
    self.leadingCon.constant=self.leadingCon.constant==0? -LSRScreenW:0;
    
    [UIView animateWithDuration:0.25 animations:^{
        [self.view layoutIfNeeded ];

    }];
    
  
    
}

-(void)viewDidLayoutSubviews
{

//    registerView.xmg_x=self.middleView.xmg_width*0.5;
//
//    fastLoginView.frame=self.bottomView.bounds;
    
    LSRLoginView *loginView = _middleView.subviews[0];
    loginView.frame = CGRectMake(0, 0, _middleView.xmg_width * 0.5, _middleView.xmg_height);
    
    LSRLoginView *registerView = _middleView.subviews[1];
    registerView.frame = CGRectMake(_middleView.xmg_width * 0.5, 0, _middleView.xmg_width * 0.5, _middleView.xmg_height);
    
    // 底部view
    LSRFastLoginView *fastView = _bottomView.subviews.firstObject;
    fastView.frame = _bottomView.bounds;

}

@end
